package com.lagou.rmi.service.impl;

import com.lagou.rmi.pojo.User;
import com.lagou.rmi.service.IUserService;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: yx
 * @date: 2021/11/23 16:33
 */
public class UserServiceImpl extends UnicastRemoteObject implements IUserService {

    private Map<Integer, User> map = new HashMap<>();

    public UserServiceImpl() throws RemoteException {
        map.put(1, new User(1, "张三"));
        map.put(2, new User(2, "李四"));
    }

    @Override
    public User getById(int id) throws RemoteException {
        return map.get(id);
    }
}
